Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

interface System.​Numerics.​INumber<​TSelf>

Assembly: System.Runtime

Implemented Interfaces

Defines a number type.

Methods

static TSelf
Clamp​(TSelf value, TSelf min, TSelf max)
Clamps a value to an inclusive minimum and maximum value.
Returns The result of clamping <paramref name="value" /> to the inclusive range of <paramref name="min" /> and <paramref name="max" /> .
value The value to clamp.
min The inclusive minimum to which <paramref name="value" /> should clamp.
max The inclusive maximum to which <paramref name="value" /> should clamp.
static TSelf
ClampNative​(TSelf value, TSelf min, TSelf max)
Clamps a value to an inclusive minimum and maximum value using platform-specific behavior for <c>NaN</c> and <c>NegativeZero</c> .
Returns The result of clamping <paramref name="value" /> to the inclusive range of <paramref name="min" /> and <paramref name="max" /> .
value The value to clamp.
min The inclusive minimum to which <paramref name="value" /> should clamp.
max The inclusive maximum to which <paramref name="value" /> should clamp.
static TSelf
CopySign​(TSelf value, TSelf sign)
Copies the sign of a value to the sign of another value.
Returns A value with the magnitude of <paramref name="value" /> and the sign of <paramref name="sign" /> .
value The value whose magnitude is used in the result.
sign The value whose sign is used in the result.
static TSelf
Max​(TSelf x, TSelf y)
Compares two values to compute which is greater.
Returns <paramref name="x" /> if it is greater than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x The value to compare with <paramref name="y" /> .
y The value to compare with <paramref name="x" /> .
static TSelf
MaxNative​(TSelf x, TSelf y)
Compares two values to compute which is greater using platform-specific behavior for <c>NaN</c> and <c>NegativeZero</c> .
Returns <paramref name="x" /> if it is greater than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x The value to compare with <paramref name="y" /> .
y The value to compare with <paramref name="x" /> .
static TSelf
MaxNumber​(TSelf x, TSelf y)
Compares two values to compute which is greater and returning the other value if an input is <c>NaN</c> .
Returns <paramref name="x" /> if it is greater than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x The value to compare with <paramref name="y" /> .
y The value to compare with <paramref name="x" /> .
static TSelf
Min​(TSelf x, TSelf y)
Compares two values to compute which is lesser.
Returns <paramref name="x" /> if it is less than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x The value to compare with <paramref name="y" /> .
y The value to compare with <paramref name="x" /> .
static TSelf
MinNative​(TSelf x, TSelf y)
Compares two values to compute which is lesser using platform-specific behavior for <c>NaN</c> and <c>NegativeZero</c> .
Returns <paramref name="x" /> if it is lesser than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x The value to compare with <paramref name="y" /> .
y The value to compare with <paramref name="x" /> .
static TSelf
MinNumber​(TSelf x, TSelf y)
Compares two values to compute which is lesser and returning the other value if an input is <c>NaN</c> .
Returns <paramref name="x" /> if it is less than <paramref name="y" /> ; otherwise, <paramref name="y" /> .
x The value to compare with <paramref name="y" /> .
y The value to compare with <paramref name="x" /> .
static int
Sign​(TSelf value)
Computes the sign of a value.
Returns A positive value if <paramref name="value" /> is positive, <c>0</c> if <paramref name="value" /> is zero, and a negative value if <paramref name="value" /> is negative.
value The value whose sign is to be computed.